package com.xuexisheqv.auth.infra.basic.service.impl;

import com.xuexisheqv.auth.infra.basic.entity.AuthRolePremission;
import com.xuexisheqv.auth.infra.basic.dao.AuthRolePremissionDao;
import com.xuexisheqv.auth.infra.basic.service.AuthRolePremissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (AuthRolePremission)表服务实现类
 *
 * @author makejava
 * @since 2024-02-17 11:50:40
 */
@Service("authRolePremissionService")
public class AuthRolePremissionServiceImpl implements AuthRolePremissionService {
    @Resource
    private AuthRolePremissionDao authRolePremissionDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public AuthRolePremission queryById(Long id) {
        return this.authRolePremissionDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param authRolePremission 实例对象
     * @return 实例对象
     */
    @Override
    public AuthRolePremission insert(AuthRolePremission authRolePremission) {
        this.authRolePremissionDao.insert(authRolePremission);
        return authRolePremission;
    }

    /**
     * 修改数据
     *
     * @param authRolePremission 实例对象
     * @return 实例对象
     */
    @Override
    public AuthRolePremission update(AuthRolePremission authRolePremission) {
        this.authRolePremissionDao.update(authRolePremission);
        return this.queryById(authRolePremission.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.authRolePremissionDao.deleteById(id) > 0;
    }

    @Override
    public Integer batchInsert(List<AuthRolePremission> rolePremissionList) {
        return authRolePremissionDao.insertBatch(rolePremissionList);
    }

    @Override
    public List<AuthRolePremission> queryByConditon(AuthRolePremission authRolePremission) {
        return this.authRolePremissionDao.queryByConditon(authRolePremission);
    }
}
